/* Sokoban
 * HIT3243
 * Authors: Mike Blackney, Ben Ingarfield, Kurniawan
 */

#pragma once

#include <list>
#include <string>
#include "dxf.h"

class HiScore : public dxf::GameStateGUI {
public:
	static HiScore* const Instance( );

	virtual HRESULT Load( );
	virtual void Unload( );

	virtual void Update(double fTime, float fElapsedTime);
	virtual void Render2D(double fTime, float fElapsedTime);
	virtual void Resize(const D3DSURFACE_DESC* pBackBufferSurfaceDesc);
	virtual bool MsgProc( HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam);
	virtual void OnGUIEvent( UINT nEvent, int nControlID, CDXUTControl* pControl, void* pUserContext );

protected:
	HiScore( );
	~HiScore( );

	// High score structure:
	struct HiScoreRecord {
		HiScoreRecord( ) { }
		HiScoreRecord( std::wstring, long, long, double );

		std::wstring sName;
		long iTurns, iPushes;
		double fTime;

		bool operator <( const HiScoreRecord &other ) const;
	};

	// Structure for sorting high-score lists:
	struct compare_list {
		bool operator()(int i1, int i2) const {
			return i1 < i2;
		}
	};

	std::map< int, 
		      std::list<HiScoreRecord>,
			  compare_list > HiScoreLists;

	bool bEnteringScore;
	double fExitTime;

	dxf::Font font;
	dxf::Sprite title;
};
